{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:25:49.807699Z",
     "start_time": "2024-02-17T08:25:49.800381Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123\n"
     ]
    }
   ],
   "source": [
    "#类型强制转换\n",
    "print(int(123.456))  #取整"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "abc = 123\n",
    "print(type(abc))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:44:38.278643Z",
     "start_time": "2024-02-17T08:44:38.273713Z"
    }
   },
   "id": "5238055a7e098ab7",
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "abc = \"abc\"\n",
    "print(type(abc))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:45:24.430033Z",
     "start_time": "2024-02-17T08:45:24.424133Z"
    }
   },
   "id": "190bd0c41a224414",
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "abc = \"123\"\n",
    "print(type(abc))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:45:40.785833Z",
     "start_time": "2024-02-17T08:45:40.775935Z"
    }
   },
   "id": "7baf3f256ae78a08",
   "execution_count": 4
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "abc = \"123\"\n",
    "xyz = int(abc)\n",
    "print(type(xyz))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:46:19.823185Z",
     "start_time": "2024-02-17T08:46:19.817419Z"
    }
   },
   "id": "5311dd236b5172dd",
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'int'>\n",
      "<class 'int'>\n",
      "1 + 2 = 3\n"
     ]
    }
   ],
   "source": [
    "a = int(input(\"Enter a number: \"))\n",
    "b = int(input(\"Enter another number: \"))\n",
    "print(type(a))\n",
    "print(type(b))\n",
    "c = a + b\n",
    "print(\"%d + %d = %d\" %(a, b, c))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-17T08:51:14.490976Z",
     "start_time": "2024-02-17T08:51:12.941732Z"
    }
   },
   "id": "eaf4d71a4c8aa101",
   "execution_count": 12
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "28d6cff5e1ca8b5d"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
